#coding=utf-8
import smtplib
from email.mime.text import MIMEText
from email.header import Header

#发送邮箱账户/密码
sender = 'brothertest@163.com'
password = 'caibo51201314'

#接受邮箱
receiver = 'renboloveshe@qq.com'

#发送邮件主题
subject = '自动发送'

#发送邮箱服务器
smtpserver = 'smtp.163.com'

#中文需参数‘utf-8’,单字节字符不需要
msg = MIMEText('闲来无聊骚扰博兄，测试一哈程序能否运行，勿回！','plain','utf-8')
msg['From'] = '<brothertest@163.com>'
msg['To'] =  '3444736670@qq.com'
msg['Subject'] = Header(subject,'utf-8')

smtp = smtplib.SMTP(smtpserver)
#smtp.connect(smtpserver)
smtp.login(sender,password)
smtp.sendmail(sender, receiver, msg.as_string())
smtp.close()